﻿using System.Text;
using System.Threading.Tasks;

namespace System.IO
{
    public static class StreamExtensions
    {
        public static async Task WriteAndFlushAsync(this FileStream fileStream, string text)
        {
            var bytes = Encoding.UTF8.GetBytes(text);
            await fileStream.WriteAsync(bytes);
            await fileStream.FlushAsync();
        }
    }
}
